import request from '@/utils/request';

// 返回码配置管理列表查询
export function getCodeList(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode',
		method: 'post',
		data: data,
	});
}

// 根据ID查询返回码配置管理数据
export function getById(id: string | number): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode/' + id,
		method: 'get',
	});
}

// 返回码删除
export function deleteData(ids: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode/delete/' + ids,
		method: 'delete',
	});
}

// 保存返回码管理信息
export function save(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode/save',
		method: 'post',
		data: data,
	});
}
// 更新返回码管理信息
export function edit(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode',
		method: 'put',
		data: data,
	});
}

// 查询IdAndName
export function getIdAndName(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode/getCodeDetail',
		method: 'post',
		data,
	});
}

/**
 * 下载返回码导入模板
 * @returns 导入模板
 */
export function importTemplate(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode/importTemplate',
		method: 'get',
		responseType: 'blob',
	});
}

/**
 * 导入
 */
export function upload(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/returnCode/upload',
		method: 'post',
		data,
	});
}
